
/* ______________________________________________________________________

	Queue Class
	This class encapsulates the JS array queue functionality.

	License: MIT License

	Vaca Framework
	http://vaca-framework.googlecode.com/
   ______________________________________________________________________
*/

Vaca.DataStructures.Queue = new Class({
	ClassName: 'Queue',
	Extends: Vaca.BaseObject,
	
	data: new Array(),
	
	// Adds new element to the end of the queue
	add: function(item) {
		this.data.push(item); 
	},
	
	// Removes first element of the queue
	remove: function() {
		return this.data.shift(); 
	},
	
	// Checks if queue is empty
	isEmpty: function() {
		return (this.data.length < 1);
	},
	
	// Empties the queue
	empty: function() {
		this.data.length = 0;
	}
});
